class Visitor < ActiveRecord::Base
  belongs_to :event
  has_many :participants

  # user_hashを元にQRコード表示用URL文字列を返す
  def qr_code
    return "" if self.user_hash.nil? or self.user_hash.empty?
    base_url = "http://chart.apis.google.com/chart?cht=qr&choe=UTF-8&chs=150x150&chl="
    return base_url + self.user_hash
  end
end
